#ifndef H_PUP_VECTOR_H
#define H_PUP_VECTOR_H

#include "item.h"

#include <stdbool.h>

typedef struct pup_vector {
  pup_item_t* begin;
  pup_item_t* end;
  pup_item_t* alloc_end;
} pup_vector_t;

// init/uninit
static inline int pup_vector_init(pup_vector_t* __restrict__ vector);
static inline int pup_vector_uninit(pup_vector_t* __restrict__ vector);

// properties
static inline size_t pup_vector_capacity(pup_vector_t const* __restrict__ vector);
static inline bool   pup_vector_empty(pup_vector_t const* __restrict__ vector);
static inline int    pup_vector_reserve(pup_vector_t* __restrict__ vector, size_t capacity);
static inline int    pup_vector_resize(pup_vector_t* __restrict__ vector, size_t size);
static inline size_t pup_vector_size(pup_vector_t const* __restrict__ vector);

// iterating
static inline pup_item_t const* pup_vector_begin_const(pup_vector_t const* __restrict__ vector);
static inline pup_item_t const* pup_vector_end_const(pup_vector_t const* __restrict__ vector);
static inline pup_item_t* pup_vector_begin(pup_vector_t* __restrict__ vector);
static inline pup_item_t* pup_vector_end(pup_vector_t* __restrict__ vector);

// access
static inline pup_item_t* pup_vector_at_index(pup_vector_t* __restrict__ vector, size_t index);
static inline pup_item_t const* pup_vector_at_index_const(pup_vector_t const* __restrict__ vector,
                                                          size_t index);

// modify
static inline int pup_vector_push_back(pup_vector_t* __restrict__ vector, pup_item_t item);

#include "inlines/vector.inl"

#endif /* H_PUP_VECTOR_H */

